package cn.lastcc.ui.event;

import java.awt.Dialog;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class WindowCloseing extends WindowAdapter {

	Frame frame = null;
	Dialog dialog = null;
	boolean exit;

	@Override
	public void windowClosing(WindowEvent e) {
		if(this.frame != null)
			this.frame.dispose();
		if(this.dialog != null)
			this.dialog.dispose();
		if(this.exit)
			System.exit(0);
	}

	public WindowCloseing(Frame frame, boolean exit) {
		this.frame = frame;
		this.exit = exit;
	}

	public WindowCloseing(Dialog dialog, boolean exit) {
		this.dialog = dialog;
		this.exit = exit;
	}

}
